//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.aidong.dao.wills;

import com.aidong.dao.base.ConditionMap;
import com.aidong.dao.base.OrderSet;
import com.aidong.dao.base.Pagination;
import com.aidong.dao.wills.BaseDao;
import com.aidong.model.wills.PssForPopProduct;
import com.aidong.model.wills.PssProductCode;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Repository;

@Repository
public class PssProductCodeDao extends BaseDao<PssProductCode, String> {
    public PssProductCodeDao() {
    }

    public List<PssProductCode> getValidProductList(String saleFlg) {
        String sqlww = "groundingDate<getdate() and undercarriageDate>getdate() and status=1 and saleFlg=:p1";
        return this.queryList(sqlww, new Object[]{saleFlg}, (new OrderSet()).asc("productCode"), -1);
    }

    public void getProductStockLst(Pagination<PssForPopProduct> pagination, ConditionMap cd) {
        ArrayList params = new ArrayList();
        String sqlw = cd.toSql(params);
        String sql = " select a.ProductCode,a.Quantity,b.Unit,b.ProductType,b.ProductName,b.Spell,b.Price \n,b.AllowanceTypePrice1,b.AllowanceTypePrice2,b.AllowanceTypePrice3,b.AllowanceTypePrice4,b.AllowanceTypePrice5 \nfrom PssProductStock a \ninner join PssProductCode b on a.ProductCode = b.ProductCode \n" + (sqlw.length() > 0?"where " + sqlw + " and  a.Quantity > 0 and b.Status = \'1\' ":" where a.Quantity > 0 and b.Status = \'1\'");
        sql = sql + "  order by a.ProductCode \n";
        this.queryPageListBySql(PssForPopProduct.class, pagination, sql, params.toArray());
    }

    public void queryProductPageList(Pagination<PssForPopProduct> pagination, ConditionMap cd) {
        ArrayList params = new ArrayList();
        String sqlw = cd.toSql(params);
        String sql = " select b.ProductCode, b.Unit,b.ProductType,b.ProductName,b.Spell,b.Price \n,b.AllowanceTypePrice1,b.AllowanceTypePrice2,b.AllowanceTypePrice3,b.AllowanceTypePrice4,b.AllowanceTypePrice5 \nfrom PssProductCode b \n" + (sqlw.length() > 0?"where " + sqlw + " and b.Status = \'1\' ":" where b.Status = \'1\'");
        sql = sql + "  order by b.ProductCode \n";
        this.queryPageListBySql(PssForPopProduct.class, pagination, sql, params.toArray());
    }
}
